package com.mhc.suzuki.api.service;

import com.mhc.suzuki.api.model.DealerDetailDTO;
import com.mhc.suzuki.api.model.DealerInfoDTO;
import com.mhc.suzuki.api.model.DealerQueryDTO;
import com.mhc.suzuki.exception.SuzukiCommonException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;


import java.util.List;

/**
 * Created by HW
 * on 2017/9/15 11:02.
 */
@FeignClient("SUZUKI")
@RequestMapping("/feign/IDealerService")
public interface IDealerService {

    /**
     * 条件查询经销商列表
     * @param dealerQueryBO
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/getDealerInfoDOS"}, method = {RequestMethod.POST})
    List<DealerInfoDTO> getDealerInfoDOS(@RequestBody DealerQueryDTO dealerQueryBO) throws SuzukiCommonException;

    /**
     * 获取全部经销商
     * @param dealerQueryBO
     * @param keyword
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/getAllDealerInfoDOS"}, method = {RequestMethod.POST})
    List<DealerInfoDTO> getAllDealerInfoDOS(@RequestBody DealerQueryDTO dealerQueryBO,@RequestParam("keyword") String keyword) throws SuzukiCommonException;

    /**
     * 条件查询经销商总数
     * @param dealerQueryBO
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/getCountByQuery"}, method = {RequestMethod.POST})
    Integer getCountByQuery(@RequestBody DealerQueryDTO dealerQueryBO) throws SuzukiCommonException;

    /**
     * 根据Id号获取经销商具体信息
     * @param dealerId
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/getDealerDetail"}, method = {RequestMethod.GET})
    DealerDetailDTO getDealerDetail(@RequestParam("dealerId") Long dealerId) throws SuzukiCommonException;

    /**
     * 根据Id号删除对应经销商信息
     * @param dealerId
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/deleteDealerById"}, method = {RequestMethod.GET})
    Boolean deleteDealerById(@RequestParam("dealerId") Long dealerId) throws SuzukiCommonException;


    /**
     * 添加经销商
     * @param dealerDetailDTO
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/addDealer"}, method = {RequestMethod.POST})
    Boolean addDealer(@RequestBody DealerDetailDTO dealerDetailDTO) throws SuzukiCommonException;

    /**
     * 经销商数据更新
     * @param dealerDetailDTO
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/updateDealer"}, method = {RequestMethod.POST})
    Boolean updateDealer(@RequestBody DealerDetailDTO dealerDetailDTO) throws SuzukiCommonException;
}
